package com.itheima.app;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * @author kabuda
 * @create 2022-08-26 19:56
 */
public class ItextDemo {
        public static void main(String[] args) {
            try {
                Document document = new Document();
                PdfWriter.getInstance(document, new FileOutputStream("D:\\test.pdf"));
                document.open();
                document.add(new Paragraph("hello itext."));
                document.close();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (DocumentException e) {
                e.printStackTrace();
            }
        }
    }

